﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admins/Administrator.Master" AutoEventWireup="true"
    CodeFile="Ebook.aspx.cs" Inherits="FacebookApp.Admins_Ebook" %>
<%@ MasterType VirtualPath="~/Admins/Administrator.Master" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register src="../Modules/Uploader.ascx" tagname="Uploader" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="title">
        Product Manager</div>
    <asp:Panel ID="pnShow" runat="server" Width="100%">
        <table id="Table1" style="border-collapse: collapse; background-color: #EBEEF4;"
            cellpadding="0" width="100%" border="0">
            <tr>
                <td class="name_fild_row">
                
                <asp:Panel ID="pngroupuser" runat="server" Visible="false">
                Group User:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="ddlgroupuser" runat="server" Width="200px">
                    </asp:DropDownList>
                </asp:Panel>
                    Group Product:&nbsp;<asp:DropDownList ID="dllCatelogy_Id" runat="server" Width="200px">
                    </asp:DropDownList>
                    <asp:Button ID="btnshow" runat="server" Text="Display" OnClick="btnshow_Click" class="fb_invite_button">
                    </asp:Button>                
                
                </td>
            </tr>            
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnThem" runat="server" class="fb_invite_button" Text="Add" OnClick="btnThem_Click" />
                    <asp:Button ID="btnXoa" runat="server" class="fb_invite_button" Text="Delete" OnClick="btnXoa_Click" />
                </td>
            </tr>
        </table>
        <asp:DataGrid ID="grdEbook" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="4" ForeColor="#333333" Width="100%" OnPageIndexChanged="grdEbook_PageIndexChanged"
            PageSize="5" OnItemCommand="grdEbook_ItemCommand" OnItemDataBound="grdEbook_ItemDataBound">
            <AlternatingItemStyle BackColor="White" />
            <HeaderStyle CssClass="trHeader"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn ItemStyle-CssClass="tdCenter">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="False"></asp:CheckBox></HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelect" runat="server"></asp:CheckBox></ItemTemplate>
                    <ItemStyle CssClass="tdCenter" HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="Id" HeaderText="Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Category_Id" HeaderText="Catgory_Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Name" HeaderText="Name"></asp:BoundColumn>
                
                <%--<asp:BoundColumn DataField="Image" HeaderText="Image"></asp:BoundColumn>--%>

                <asp:TemplateColumn>
                    <HeaderTemplate>
                        Image</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Image1" ImageUrl='<%#Eval("Image") %>' Width="80px" Height="60px"
                            runat="server" />
                    </ItemTemplate>
                </asp:TemplateColumn>

                <asp:BoundColumn DataField="File_Upload" HeaderText="File_Upload" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Promotion" HeaderText="Promotion" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Detail" HeaderText="Detail"></asp:BoundColumn>

                <%--<asp:BoundColumn DataField="Price" HeaderText="Price"></asp:BoundColumn>--%>

                <asp:TemplateColumn >
                    <HeaderTemplate>
                        Price</HeaderTemplate>
                    <ItemTemplate>
                        <%#Format_Price(Eval("Price").ToString()) %></ItemTemplate>
                </asp:TemplateColumn>

                <%--<asp:BoundColumn DataField="PriceNew" HeaderText="PriceNew"></asp:BoundColumn>--%>

                <asp:TemplateColumn>
                    <HeaderTemplate>
                        NewPrice</HeaderTemplate>
                    <ItemTemplate>
                        <%#Format_Price(Eval("PriceNew").ToString())%></ItemTemplate>
                </asp:TemplateColumn>

                <asp:BoundColumn DataField="Status" HeaderText="Status" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="NumView" HeaderText="View" ItemStyle-HorizontalAlign="Center"></asp:BoundColumn>
                <asp:BoundColumn DataField="Size" HeaderText="Size" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Publisher_Id" HeaderText="Publisher_Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="YearPub" HeaderText="YearPub" Visible="false" ></asp:BoundColumn>
                <asp:BoundColumn DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center"></asp:BoundColumn>
                <asp:BoundColumn DataField="NumPage" HeaderText="NumPage" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Author_Id" HeaderText="Author_Id" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Weight" HeaderText="Weight" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="NumLike" HeaderText="Like" ItemStyle-HorizontalAlign="Center" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="NumBought" HeaderText="Bought" ItemStyle-HorizontalAlign="Center"></asp:BoundColumn>
                <asp:BoundColumn DataField="isFree" HeaderText="Free"></asp:BoundColumn>
                <asp:BoundColumn DataField="isOnlineView" HeaderText="isOnlineView" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="CreatedBy" HeaderText="CreatedBy" Visible="false"></asp:BoundColumn>
                <asp:BoundColumn DataField="Order" HeaderText="Order" Visible="false" ></asp:BoundColumn>
                <asp:TemplateColumn ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        Function</HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="lbt1" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")%>'
                            CommandName="Edit" CssClass="edit" ToolTip="View/Edit">&nbsp;</asp:LinkButton>|<asp:LinkButton
                                ID="lbt2" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")%>'
                                CommandName="Delete" CssClass="delete" OnClientClick="return confirm(&quot;Bạn có muốn xóa không?&quot;)"
                                ToolTip="Delete">&nbsp;</asp:LinkButton>|
                                <asp:LinkButton ID="lbt3" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id")%>'
                            CommandName="PostWall" CssClass="post" ToolTip="Post your friend's wall"></asp:LinkButton>
                                </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                </asp:TemplateColumn>
            </Columns>
            <EditItemStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
            <ItemStyle BackColor="#EFF3FB" />
            <PagerStyle BackColor="#F3F8FE" ForeColor="Blue" HorizontalAlign="Center" Mode="NumericPages" />
            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        </asp:DataGrid></asp:Panel>
    <asp:Panel ID="pnUpdate" runat="server" Visible="False" Width="100%">
        <table id="Table2" style="border-collapse: collapse" cellpadding="0" width="100%"
            border="0">
            <tr>
                <td width="150" height="10">
                </td>
                <td height="10">
                </td>
            </tr>
            <tr>
                <td style="display:none;">
                    &nbsp;<asp:Label ID="lblId" runat="server">Id</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:TextBox ID="txtId" runat="server" ></asp:TextBox>
                </td>
            </tr>            
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblName" runat="server">Name</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblImage" runat="server">Image</asp:Label>
                </td>
                <td>
                    <%--<asp:TextBox ID="txtImage" runat="server" Width="200px"></asp:TextBox>--%>
                    <uc1:Uploader ID="Uploader1" runat="server" />

                </td>
            </tr>
            <tr >
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblFile_Upload" runat="server">File_Upload</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:TextBox ID="txtFile_Upload" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>            
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblDetail" runat="server">Detail</asp:Label>
                </td>
                <td>
                    &nbsp;<FCKeditorV2:FCKeditor ID="FCKdetail" runat="server" Width="80%" BasePath="~/fckeditor/" Height="400px">
                    </FCKeditorV2:FCKeditor>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblPrice" runat="server">Price</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPrice" runat="server" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="txtPrice"
                        Display="Dynamic" ErrorMessage="Price not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblPriceNew" runat="server">PriceNew</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPriceNew" runat="server" Width="200px" Text="0"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="txtPriceNew"
                        Display="Dynamic" ErrorMessage="NewPrice not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblQuantity" runat="server">Quantity</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtQuantity" runat="server" Width="200px" Text="1"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator3" ControlToValidate="txtQuantity"
                        Display="Dynamic" ErrorMessage="Quantity not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblCatgory_Id" runat="server">Catgory</asp:Label>
                </td>
                <td>
                    <%--<asp:TextBox ID="txtCatgory_Id" runat="server" Width="200px"></asp:TextBox>--%>
                    <asp:DropDownList ID="ddlcatogory" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblPublisher_Id" runat="server">Publisher</asp:Label>
                </td>
                <td style="display:none;">
                    <%--<asp:TextBox ID="txtPublisher_Id" runat="server" Width="200px"></asp:TextBox>--%>
                    <asp:DropDownList ID="ddlpublisher" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblAuthor_Id" runat="server">Author</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:DropDownList ID="dllAuthor_Id_Update" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblStatus" runat="server">Status</asp:Label>
                </td>
                <td>
                    <%--<asp:TextBox ID="txtStatus" runat="server" Width="200px"></asp:TextBox>--%>
                    <asp:DropDownList ID="ddlStatus" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblPromotion" runat="server">Promotion</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPromotion" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblSize" runat="server">Size</asp:Label>
                </td>
                <td  style="display:none;">
                    <asp:TextBox ID="txtSize" runat="server" Width="200px" Text="0"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator4" ControlToValidate="txtSize"
                        Display="Dynamic" ErrorMessage="Size not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblYearPub" runat="server">YearPub</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:TextBox ID="txtYearPub" runat="server" Width="200px" Text="0"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator5" ControlToValidate="txtYearPub"
                        Display="Dynamic" ErrorMessage="YearPub not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblNumPage" runat="server">NumPage</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:TextBox ID="txtNumPage" runat="server" Width="200px" Text="0"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator6" ControlToValidate="txtNumPage"
                        Display="Dynamic" ErrorMessage="NumPage not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>            
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblWeight" runat="server">Weight</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:TextBox ID="txtWeight" runat="server" Width="200px" Text="0"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator7" ControlToValidate="txtWeight"
                        Display="Dynamic" ErrorMessage="Weight not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblisFree" runat="server">isFree</asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddtisfree" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row" style="display:none;">
                    &nbsp;<asp:Label ID="lblisOnlineView" runat="server">isOnlineView</asp:Label>
                </td>
                <td style="display:none;">
                    <asp:DropDownList ID="ddlisonline" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td width="150" class="name_fild_row">
                    &nbsp;<asp:Label ID="lblOrder" runat="server">Order</asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtOrder" runat="server" Width="200px" Text="1"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator8" ControlToValidate="txtOrder"
                        Display="Dynamic" ErrorMessage="Order not number format" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)"
                        ForeColor="Red">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
            <td></td>
            <td>
                <asp:CheckBox ID="cbpost" runat="server" Text="Post to my wall"/>
            </td>
            </tr>
            <tr>
                <td width="150">
                    &nbsp;
                </td>
                <td>
                    &nbsp;<asp:LinkButton ID="lbtUpdate" CssClass="update" runat="server" OnClick="lblUpdate_Click">Update</asp:LinkButton>&nbsp;&nbsp;
                    <asp:LinkButton ID="lblBack" runat="server" CssClass="back" OnClick="lblBack_Click">Back</asp:LinkButton>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="pnPost" runat="server" Width="100%" Visible="false">
        <center>
            <asp:DataGrid ID="grdPost" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                CellPadding="4" ForeColor="#333333" Width="600px" OnPageIndexChanged="grdPost_PageIndexChanged"
                PageSize="10" OnItemCommand="grdPost_ItemCommand" OnItemDataBound="grdPost_ItemDataBound">
                <AlternatingItemStyle BackColor="White" />
                <HeaderStyle CssClass="trHeader"></HeaderStyle>
                <Columns>
                    <asp:TemplateColumn ItemStyle-CssClass="tdCenter" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="False"></asp:CheckBox></HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSelect" runat="server"></asp:CheckBox></ItemTemplate>
                        <ItemStyle CssClass="tdCenter" HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="Id" HeaderText="Id" Visible="false"></asp:BoundColumn>
                    <%--<asp:BoundColumn DataField="Image" HeaderText="Image"></asp:BoundColumn>--%>
                    <asp:TemplateColumn ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate>
                            Image</HeaderTemplate>
                        <ItemTemplate>
                            <asp:Image ID="Image1" ImageUrl='<%#Eval("pic_small") %>' Width="80px" Height="80px"
                                runat="server" />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <%--<asp:BoundColumn DataField="Price" HeaderText="Price"></asp:BoundColumn>--%>
                    <asp:TemplateColumn ItemStyle-Width="200px">
                        <HeaderTemplate>
                            Tên</HeaderTemplate>
                        <ItemTemplate>
                            <%#Eval("name").ToString()%></ItemTemplate>
                    </asp:TemplateColumn>
                </Columns>
                <EditItemStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
                <ItemStyle BackColor="#EFF3FB" />
                <PagerStyle BackColor="#F3F8FE" ForeColor="Blue" HorizontalAlign="Center" Mode="NumericPages" />
                <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            </asp:DataGrid>
            <%--<asp:Button ID="btpost" Text="Đăng tường" runat="server" 
                onclick="btpost_Click"/>--%>
                <asp:LinkButton ID="lbpost" runat="server" CssClass="sendpost" OnClick="btpost_Click">Post wall</asp:LinkButton>
                <asp:LinkButton ID="lbback2" runat="server" CssClass="back" OnClick="lblBack2_Click">Back</asp:LinkButton>
        </center>
    </asp:Panel>
</asp:Content>
